home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / Dev / gcc-2.6.3-bin.lha / GNU / info / gcc.info-19 (.txt) < prev    next >
GNU Info File  |  1995-03-30  |  51KB  |  861 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.55 from the input
  2. file gcc.texi.
  3.    This file documents the use and the internals of the GNU compiler.
  4.    Published by the Free Software Foundation 675 Massachusetts Avenue
  5. Cambridge, MA 02139 USA
  6.    Copyright (C) 1988, 1989, 1992, 1993, 1994 Free Software Foundation,
  7.    Permission is granted to make and distribute verbatim copies of this
  8. manual provided the copyright notice and this permission notice are
  9. preserved on all copies.
  10.    Permission is granted to copy and distribute modified versions of
  11. this manual under the conditions for verbatim copying, provided also
  12. that the sections entitled "GNU General Public License," "Funding for
  13. Free Software," and "Protect Your Freedom--Fight `Look And Feel'" are
  14. included exactly as in the original, and provided that the entire
  15. resulting derived work is distributed under the terms of a permission
  16. notice identical to this one.
  17.    Permission is granted to copy and distribute translations of this
  18. manual into another language, under the above conditions for modified
  19. versions, except that the sections entitled "GNU General Public
  20. License," "Funding for Free Software," and "Protect Your Freedom--Fight
  21. `Look And Feel'", and this permission notice, may be included in
  22. translations approved by the Free Software Foundation instead of in the
  23. original English.
  24. File: gcc.info,  Node: Obsolete Register Macros,  Prev: Stack Registers,  Up: Registers
  25. Obsolete Macros for Controlling Register Usage
  26. ----------------------------------------------
  27.    These features do not work very well.  They exist because they used
  28. to be required to generate correct code for the 80387 coprocessor of the
  29. 80386.  They are no longer used by that machine description and may be
  30. removed in a later version of the compiler.  Don't use them!
  31. `OVERLAPPING_REGNO_P (REGNO)'
  32.      If defined, this is a C expression whose value is nonzero if hard
  33.      register number REGNO is an overlapping register.  This means a
  34.      hard register which overlaps a hard register with a different
  35.      number.  (Such overlap is undesirable, but occasionally it allows
  36.      a machine to be supported which otherwise could not be.)  This
  37.      macro must return nonzero for *all* the registers which overlap
  38.      each other.  GNU CC can use an overlapping register only in
  39.      certain limited ways.  It can be used for allocation within a
  40.      basic block, and may be spilled for reloading; that is all.
  41.      If this macro is not defined, it means that none of the hard
  42.      registers overlap each other.  This is the usual situation.
  43. `INSN_CLOBBERS_REGNO_P (INSN, REGNO)'
  44.      If defined, this is a C expression whose value should be nonzero if
  45.      the insn INSN has the effect of mysteriously clobbering the
  46.      contents of hard register number REGNO.  By "mysterious" we mean
  47.      that the insn's RTL expression doesn't describe such an effect.
  48.      If this macro is not defined, it means that no insn clobbers
  49.      registers mysteriously.  This is the usual situation; all else
  50.      being equal, it is best for the RTL expression to show all the
  51.      activity.
  52. `PRESERVE_DEATH_INFO_REGNO_P (REGNO)'
  53.      If defined, this is a C expression whose value is nonzero if
  54.      accurate `REG_DEAD' notes are needed for hard register number REGNO
  55.      at the time of outputting the assembler code.  When this is so, a
  56.      few optimizations that take place after register allocation and
  57.      could invalidate the death notes are not done when this register is
  58.      involved.
  59.      You would arrange to preserve death info for a register when some
  60.      of the code in the machine description which is executed to write
  61.      the assembler code looks at the death notes.  This is necessary
  62.      only when the actual hardware feature which GNU CC thinks of as a
  63.      register is not actually a register of the usual sort.  (It might,
  64.      for example, be a hardware stack.)
  65.      If this macro is not defined, it means that no death notes need to
  66.      be preserved.  This is the usual situation.
  67. File: gcc.info,  Node: Register Classes,  Next: Stack and Calling,  Prev: Registers,  Up: Target Macros
  68. Register Classes
  69. ================
  70.    On many machines, the numbered registers are not all equivalent.
  71. For example, certain registers may not be allowed for indexed
  72. addressing; certain registers may not be allowed in some instructions.
  73. These machine restrictions are described to the compiler using
  74. "register classes".
  75.    You define a number of register classes, giving each one a name and
  76. saying which of the registers belong to it.  Then you can specify
  77. register classes that are allowed as operands to particular instruction
  78. patterns.
  79.    In general, each register will belong to several classes.  In fact,
  80. one class must be named `ALL_REGS' and contain all the registers.
  81. Another class must be named `NO_REGS' and contain no registers.  Often
  82. the union of two classes will be another class; however, this is not
  83. required.
  84.    One of the classes must be named `GENERAL_REGS'.  There is nothing
  85. terribly special about the name, but the operand constraint letters `r'
  86. and `g' specify this class.  If `GENERAL_REGS' is the same as
  87. `ALL_REGS', just define it as a macro which expands to `ALL_REGS'.
  88.    Order the classes so that if class X is contained in class Y then X
  89. has a lower class number than Y.
  90.    The way classes other than `GENERAL_REGS' are specified in operand
  91. constraints is through machine-dependent operand constraint letters.
  92. You can define such letters to correspond to various classes, then use
  93. them in operand constraints.
  94.    You should define a class for the union of two classes whenever some
  95. instruction allows both classes.  For example, if an instruction allows
  96. either a floating point (coprocessor) register or a general register
  97. for a certain operand, you should define a class `FLOAT_OR_GENERAL_REGS'
  98. which includes both of them.  Otherwise you will get suboptimal code.
  99.    You must also specify certain redundant information about the
  100. register classes: for each class, which classes contain it and which
  101. ones are contained in it; for each pair of classes, the largest class
  102. contained in their union.
  103.    When a value occupying several consecutive registers is expected in a
  104. certain class, all the registers used must belong to that class.
  105. Therefore, register classes cannot be used to enforce a requirement for
  106. a register pair to start with an even-numbered register.  The way to
  107. specify this requirement is with `HARD_REGNO_MODE_OK'.
  108.    Register classes used for input-operands of bitwise-and or shift
  109. instructions have a special requirement: each such class must have, for
  110. each fixed-point machine mode, a subclass whose registers can transfer
  111. that mode to or from memory.  For example, on some machines, the
  112. operations for single-byte values (`QImode') are limited to certain
  113. registers.  When this is so, each register class that is used in a
  114. bitwise-and or shift instruction must have a subclass consisting of
  115. registers from which single-byte values can be loaded or stored.  This
  116. is so that `PREFERRED_RELOAD_CLASS' can always have a possible value to
  117. return.
  118. `enum reg_class'
  119.      An enumeral type that must be defined with all the register class
  120.      names as enumeral values.  `NO_REGS' must be first.  `ALL_REGS'
  121.      must be the last register class, followed by one more enumeral
  122.      value, `LIM_REG_CLASSES', which is not a register class but rather
  123.      tells how many classes there are.
  124.      Each register class has a number, which is the value of casting
  125.      the class name to type `int'.  The number serves as an index in
  126.      many of the tables described below.
  127. `N_REG_CLASSES'
  128.      The number of distinct register classes, defined as follows:
  129.           #define N_REG_CLASSES (int) LIM_REG_CLASSES
  130. `REG_CLASS_NAMES'
  131.      An initializer containing the names of the register classes as C
  132.      string constants.  These names are used in writing some of the
  133.      debugging dumps.
  134. `REG_CLASS_CONTENTS'
  135.      An initializer containing the contents of the register classes, as
  136.      integers which are bit masks.  The Nth integer specifies the
  137.      contents of class N.  The way the integer MASK is interpreted is
  138.      that register R is in the class if `MASK & (1 << R)' is 1.
  139.      When the machine has more than 32 registers, an integer does not
  140.      suffice.  Then the integers are replaced by sub-initializers,
  141.      braced groupings containing several integers.  Each
  142.      sub-initializer must be suitable as an initializer for the type
  143.      `HARD_REG_SET' which is defined in `hard-reg-set.h'.
  144. `REGNO_REG_CLASS (REGNO)'
  145.      A C expression whose value is a register class containing hard
  146.      register REGNO.  In general there is more than one such class;
  147.      choose a class which is "minimal", meaning that no smaller class
  148.      also contains the register.
  149. `BASE_REG_CLASS'
  150.      A macro whose definition is the name of the class to which a valid
  151.      base register must belong.  A base register is one used in an
  152.      address which is the register value plus a displacement.
  153. `INDEX_REG_CLASS'
  154.      A macro whose definition is the name of the class to which a valid
  155.      index register must belong.  An index register is one used in an
  156.      address where its value is either multiplied by a scale factor or
  157.      added to another register (as well as added to a displacement).
  158. `REG_CLASS_FROM_LETTER (CHAR)'
  159.      A C expression which defines the machine-dependent operand
  160.      constraint letters for register classes.  If CHAR is such a
  161.      letter, the value should be the register class corresponding to
  162.      it.  Otherwise, the value should be `NO_REGS'.  The register
  163.      letter `r', corresponding to class `GENERAL_REGS', will not be
  164.      passed to this macro; you do not need to handle it.
  165. `REGNO_OK_FOR_BASE_P (NUM)'
  166.      A C expression which is nonzero if register number NUM is suitable
  167.      for use as a base register in operand addresses.  It may be either
  168.      a suitable hard register or a pseudo register that has been
  169.      allocated such a hard register.
  170. `REGNO_OK_FOR_INDEX_P (NUM)'
  171.      A C expression which is nonzero if register number NUM is suitable
  172.      for use as an index register in operand addresses.  It may be
  173.      either a suitable hard register or a pseudo register that has been
  174.      allocated such a hard register.
  175.      The difference between an index register and a base register is
  176.      that the index register may be scaled.  If an address involves the
  177.      sum of two registers, neither one of them scaled, then either one
  178.      may be labeled the "base" and the other the "index"; but whichever
  179.      labeling is used must fit the machine's constraints of which
  180.      registers may serve in each capacity.  The compiler will try both
  181.      labelings, looking for one that is valid, and will reload one or
  182.      both registers only if neither labeling works.
  183. `PREFERRED_RELOAD_CLASS (X, CLASS)'
  184.      A C expression that places additional restrictions on the register
  185.      class to use when it is necessary to copy value X into a register
  186.      in class CLASS.  The value is a register class; perhaps CLASS, or
  187.      perhaps another, smaller class.  On many machines, the following
  188.      definition is safe:
  189.           #define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
  190.      Sometimes returning a more restrictive class makes better code.
  191.      For example, on the 68000, when X is an integer constant that is
  192.      in range for a `moveq' instruction, the value of this macro is
  193.      always `DATA_REGS' as long as CLASS includes the data registers.
  194.      Requiring a data register guarantees that a `moveq' will be used.
  195.      If X is a `const_double', by returning `NO_REGS' you can force X
  196.      into a memory constant.  This is useful on certain machines where
  197.      immediate floating values cannot be loaded into certain kinds of
  198.      registers.
  199. `PREFERRED_OUTPUT_RELOAD_CLASS (X, CLASS)'
  200.      Like `PREFERRED_RELOAD_CLASS', but for output reloads instead of
  201.      input reloads.  If you don't define this macro, the default is to
  202.      use CLASS, unchanged.
  203. `LIMIT_RELOAD_CLASS (MODE, CLASS)'
  204.      A C expression that places additional restrictions on the register
  205.      class to use when it is necessary to be able to hold a value of
  206.      mode MODE in a reload register for which class CLASS would
  207.      ordinarily be used.
  208.      Unlike `PREFERRED_RELOAD_CLASS', this macro should be used when
  209.      there are certain modes that simply can't go in certain reload
  210.      classes.
  211.      The value is a register class; perhaps CLASS, or perhaps another,
  212.      smaller class.
  213.      Don't define this macro unless the target machine has limitations
  214.      which require the macro to do something nontrivial.
  215. `SECONDARY_RELOAD_CLASS (CLASS, MODE, X)'
  216. `SECONDARY_INPUT_RELOAD_CLASS (CLASS, MODE, X)'
  217. `SECONDARY_OUTPUT_RELOAD_CLASS (CLASS, MODE, X)'
  218.      Many machines have some registers that cannot be copied directly
  219.      to or from memory or even from other types of registers.  An
  220.      example is the `MQ' register, which on most machines, can only be
  221.      copied to or from general registers, but not memory.  Some
  222.      machines allow copying all registers to and from memory, but
  223.      require a scratch register for stores to some memory locations
  224.      (e.g., those with symbolic address on the RT, and those with
  225.      certain symbolic address on the Sparc when compiling PIC).  In
  226.      some cases, both an intermediate and a scratch register are
  227.      required.
  228.      You should define these macros to indicate to the reload phase
  229.      that it may need to allocate at least one register for a reload in
  230.      addition to the register to contain the data.  Specifically, if
  231.      copying X to a register CLASS in MODE requires an intermediate
  232.      register, you should define `SECONDARY_INPUT_RELOAD_CLASS' to
  233.      return the largest register class all of whose registers can be
  234.      used as intermediate registers or scratch registers.
  235.      If copying a register CLASS in MODE to X requires an intermediate
  236.      or scratch register, `SECONDARY_OUTPUT_RELOAD_CLASS' should be
  237.      defined to return the largest register class required.  If the
  238.      requirements for input and output reloads are the same, the macro
  239.      `SECONDARY_RELOAD_CLASS' should be used instead of defining both
  240.      macros identically.
  241.      The values returned by these macros are often `GENERAL_REGS'.
  242.      Return `NO_REGS' if no spare register is needed; i.e., if X can be
  243.      directly copied to or from a register of CLASS in MODE without
  244.      requiring a scratch register.  Do not define this macro if it
  245.      would always return `NO_REGS'.
  246.      If a scratch register is required (either with or without an
  247.      intermediate register), you should define patterns for
  248.      `reload_inM' or `reload_outM', as required (*note Standard
  249.      Names::..  These patterns, which will normally be implemented with
  250.      a `define_expand', should be similar to the `movM' patterns,
  251.      except that operand 2 is the scratch register.
  252.      Define constraints for the reload register and scratch register
  253.      that contain a single register class.  If the original reload
  254.      register (whose class is CLASS) can meet the constraint given in
  255.      the pattern, the value returned by these macros is used for the
  256.      class of the scratch register.  Otherwise, two additional reload
  257.      registers are required.  Their classes are obtained from the
  258.      constraints in the insn pattern.
  259.      X might be a pseudo-register or a `subreg' of a pseudo-register,
  260.      which could either be in a hard register or in memory.  Use
  261.      `true_regnum' to find out; it will return -1 if the pseudo is in
  262.      memory and the hard register number if it is in a register.
  263.      These macros should not be used in the case where a particular
  264.      class of registers can only be copied to memory and not to another
  265.      class of registers.  In that case, secondary reload registers are
  266.      not needed and would not be helpful.  Instead, a stack location
  267.      must be used to perform the copy and the `movM' pattern should use
  268.      memory as a intermediate storage.  This case often occurs between
  269.      floating-point and general registers.
  270. `SECONDARY_MEMORY_NEEDED (CLASS1, CLASS2, M)'
  271.      Certain machines have the property that some registers cannot be
  272.      copied to some other registers without using memory.  Define this
  273.      macro on those machines to be a C expression that is non-zero if
  274.      objects of mode M in registers of CLASS1 can only be copied to
  275.      registers of class CLASS2 by storing a register of CLASS1 into
  276.      memory and loading that memory location into a register of CLASS2.
  277.      Do not define this macro if its value would always be zero.
  278. `SECONDARY_MEMORY_NEEDED_RTX (MODE)'
  279.      Normally when `SECONDARY_MEMORY_NEEDED' is defined, the compiler
  280.      allocates a stack slot for a memory location needed for register
  281.      copies.  If this macro is defined, the compiler instead uses the
  282.      memory location defined by this macro.
  283.      Do not define this macro if you do not define
  284.      `SECONDARY_MEMORY_NEEDED'.
  285. `SECONDARY_MEMORY_NEEDED_MODE (MODE)'
  286.      When the compiler needs a secondary memory location to copy
  287.      between two registers of mode MODE, it normally allocates
  288.      sufficient memory to hold a quantity of `BITS_PER_WORD' bits and
  289.      performs the store and load operations in a mode that many bits
  290.      wide and whose class is the same as that of MODE.
  291.      This is right thing to do on most machines because it ensures that
  292.      all bits of the register are copied and prevents accesses to the
  293.      registers in a narrower mode, which some machines prohibit for
  294.      floating-point registers.
  295.      However, this default behavior is not correct on some machines,
  296.      such as the DEC Alpha, that store short integers in floating-point
  297.      registers differently than in integer registers.  On those
  298.      machines, the default widening will not work correctly and you
  299.      must define this macro to suppress that widening in some cases.
  300.      See the file `alpha.h' for details.
  301.      Do not define this macro if you do not define
  302.      `SECONDARY_MEMORY_NEEDED' or if widening MODE to a mode that is
  303.      `BITS_PER_WORD' bits wide is correct for your machine.
  304. `SMALL_REGISTER_CLASSES'
  305.      Normally the compiler avoids choosing registers that have been
  306.      explicitly mentioned in the rtl as spill registers (these
  307.      registers are normally those used to pass parameters and return
  308.      values).  However, some machines have so few registers of certain
  309.      classes that there would not be enough registers to use as spill
  310.      registers if this were done.
  311.      Define `SMALL_REGISTER_CLASSES' on these machines.  When it is
  312.      defined, the compiler allows registers explicitly used in the rtl
  313.      to be used as spill registers but avoids extending the lifetime of
  314.      these registers.
  315.      It is always safe to define this macro, but if you unnecessarily
  316.      define it, you will reduce the amount of optimizations that can be
  317.      performed in some cases.  If you do not define this macro when it
  318.      is required, the compiler will run out of spill registers and
  319.      print a fatal error message.  For most machines, you should not
  320.      define this macro.
  321. `CLASS_LIKELY_SPILLED_P (CLASS)'
  322.      A C expression whose value is nonzero if pseudos that have been
  323.      assigned to registers of class CLASS would likely be spilled
  324.      because registers of CLASS are needed for spill registers.
  325.      The default value of this macro returns 1 if CLASS has exactly one
  326.      register and zero otherwise.  On most machines, this default
  327.      should be used.  Only define this macro to some other expression
  328.      if pseudo allocated by `local-alloc.c' end up in memory because
  329.      their hard registers were needed for spill regisers.  If this
  330.      macro returns nonzero for those classes, those pseudos will only
  331.      be allocated by `global.c', which knows how to reallocate the
  332.      pseudo to another register.  If there would not be another
  333.      register available for reallocation, you should not change the
  334.      definition of this macro since the only effect of such a
  335.      definition would be to slow down register allocation.
  336. `CLASS_MAX_NREGS (CLASS, MODE)'
  337.      A C expression for the maximum number of consecutive registers of
  338.      class CLASS needed to hold a value of mode MODE.
  339.      This is closely related to the macro `HARD_REGNO_NREGS'.  In fact,
  340.      the value of the macro `CLASS_MAX_NREGS (CLASS, MODE)' should be
  341.      the maximum value of `HARD_REGNO_NREGS (REGNO, MODE)' for all
  342.      REGNO values in the class CLASS.
  343.      This macro helps control the handling of multiple-word values in
  344.      the reload pass.
  345. `CLASS_CANNOT_CHANGE_SIZE'
  346.      If defined, a C expression for a class that contains registers
  347.      which the compiler must always access in a mode that is the same
  348.      size as the mode in which it loaded the register, unless neither
  349.      mode is integral.
  350.      For the example, loading 32-bit integer or floating-point objects
  351.      into floating-point registers on the Alpha extends them to 64-bits.
  352.      Therefore loading a 64-bit object and then storing it as a 32-bit
  353.      object does not store the low-order 32-bits, as would be the case
  354.      for a normal register.  Therefore, `alpha.h' defines this macro as
  355.      `FLOAT_REGS'.
  356.    Three other special macros describe which operands fit which
  357. constraint letters.
  358. `CONST_OK_FOR_LETTER_P (VALUE, C)'
  359.      A C expression that defines the machine-dependent operand
  360.      constraint letters that specify particular ranges of integer
  361.      values.  If C is one of those letters, the expression should check
  362.      that VALUE, an integer, is in the appropriate range and return 1
  363.      if so, 0 otherwise.  If C is not one of those letters, the value
  364.      should be 0 regardless of VALUE.
  365. `CONST_DOUBLE_OK_FOR_LETTER_P (VALUE, C)'
  366.      A C expression that defines the machine-dependent operand
  367.      constraint letters that specify particular ranges of
  368.      `const_double' values.
  369.      If C is one of those letters, the expression should check that
  370.      VALUE, an RTX of code `const_double', is in the appropriate range
  371.      and return 1 if so, 0 otherwise.  If C is not one of those
  372.      letters, the value should be 0 regardless of VALUE.
  373.      `const_double' is used for all floating-point constants and for
  374.      `DImode' fixed-point constants.  A given letter can accept either
  375.      or both kinds of values.  It can use `GET_MODE' to distinguish
  376.      between these kinds.
  377. `EXTRA_CONSTRAINT (VALUE, C)'
  378.      A C expression that defines the optional machine-dependent
  379.      constraint letters that can be used to segregate specific types of
  380.      operands, usually memory references, for the target machine.
  381.      Normally this macro will not be defined.  If it is required for a
  382.      particular target machine, it should return 1 if VALUE corresponds
  383.      to the operand type represented by the constraint letter C.  If C
  384.      is not defined as an extra constraint, the value returned should
  385.      be 0 regardless of VALUE.
  386.      For example, on the ROMP, load instructions cannot have their
  387.      output in r0 if the memory reference contains a symbolic address.
  388.      Constraint letter `Q' is defined as representing a memory address
  389.      that does *not* contain a symbolic address.  An alternative is
  390.      specified with a `Q' constraint on the input and `r' on the
  391.      output.  The next alternative specifies `m' on the input and a
  392.      register class that does not include r0 on the output.
  393. File: gcc.info,  Node: Stack and Calling,  Next: Varargs,  Prev: Register Classes,  Up: Target Macros
  394. Stack Layout and Calling Conventions
  395. ====================================
  396.    This describes the stack layout and calling conventions.
  397. * Menu:
  398. * Frame Layout::
  399. * Frame Registers::
  400. * Elimination::
  401. * Stack Arguments::
  402. * Register Arguments::
  403. * Scalar Return::
  404. * Aggregate Return::
  405. * Caller Saves::
  406. * Function Entry::
  407. * Profiling::
  408. File: gcc.info,  Node: Frame Layout,  Next: Frame Registers,  Up: Stack and Calling
  409. Basic Stack Layout
  410. ------------------
  411.    Here is the basic stack layout.
  412. `STACK_GROWS_DOWNWARD'
  413.      Define this macro if pushing a word onto the stack moves the stack
  414.      pointer to a smaller address.
  415.      When we say, "define this macro if ...," it means that the
  416.      compiler checks this macro only with `#ifdef' so the precise
  417.      definition used does not matter.
  418. `FRAME_GROWS_DOWNWARD'
  419.      Define this macro if the addresses of local variable slots are at
  420.      negative offsets from the frame pointer.
  421. `ARGS_GROW_DOWNWARD'
  422.      Define this macro if successive arguments to a function occupy
  423.      decreasing addresses on the stack.
  424. `STARTING_FRAME_OFFSET'
  425.      Offset from the frame pointer to the first local variable slot to
  426.      be allocated.
  427.      If `FRAME_GROWS_DOWNWARD', find the next slot's offset by
  428.      subtracting the first slot's length from `STARTING_FRAME_OFFSET'.
  429.      Otherwise, it is found by adding the length of the first slot to
  430.      the value `STARTING_FRAME_OFFSET'.
  431. `STACK_POINTER_OFFSET'
  432.      Offset from the stack pointer register to the first location at
  433.      which outgoing arguments are placed.  If not specified, the
  434.      default value of zero is used.  This is the proper value for most
  435.      machines.
  436.      If `ARGS_GROW_DOWNWARD', this is the offset to the location above
  437.      the first location at which outgoing arguments are placed.
  438. `FIRST_PARM_OFFSET (FUNDECL)'
  439.      Offset from the argument pointer register to the first argument's
  440.      address.  On some machines it may depend on the data type of the
  441.      function.
  442.      If `ARGS_GROW_DOWNWARD', this is the offset to the location above
  443.      the first argument's address.
  444. `STACK_DYNAMIC_OFFSET (FUNDECL)'
  445.      Offset from the stack pointer register to an item dynamically
  446.      allocated on the stack, e.g., by `alloca'.
  447.      The default value for this macro is `STACK_POINTER_OFFSET' plus the
  448.      length of the outgoing arguments.  The default is correct for most
  449.      machines.  See `function.c' for details.
  450. `DYNAMIC_CHAIN_ADDRESS (FRAMEADDR)'
  451.      A C expression whose value is RTL representing the address in a
  452.      stack frame where the pointer to the caller's frame is stored.
  453.      Assume that FRAMEADDR is an RTL expression for the address of the
  454.      stack frame itself.
  455.      If you don't define this macro, the default is to return the value
  456.      of FRAMEADDR--that is, the stack frame address is also the address
  457.      of the stack word that points to the previous frame.
  458. `SERTUP_FRAME_ADDRESSES ()'
  459.      If defined, a C expression that produces the machine-specific code
  460.      to setup the stack so that arbitrary frames can be accessed.  For
  461.      example, on the Sparc, we must flush all of the register windows
  462.      to the stack before we can access arbitrary stack frames.  This
  463.      macro will seldom need to be defined.
  464. `RETURN_ADDR_RTX (COUNT, FRAMEADDR)'
  465.      A C expression whose value is RTL representing the value of the
  466.      return address for the frame COUNT steps up from the current frame.
  467.      fRAMEADDR is the frame pointer of the COUNT frame, or the frame
  468.      pointer of the COUNT - 1 frame if `RETURN_ADDR_IN_PREVIOUS_FRAME'
  469.      is defined.
  470. `RETURN_ADDR_IN_PREVIOUS_FRAME'
  471.      Define this if the return address of a particular stack frame is
  472.      accessed from the frame pointer of the previous stack frame.
  473. File: gcc.info,  Node: Frame Registers,  Next: Elimination,  Prev: Frame Layout,  Up: Stack and Calling
  474. Registers That Address the Stack Frame
  475. --------------------------------------
  476.    This discusses registers that address the stack frame.
  477. `STACK_POINTER_REGNUM'
  478.      The register number of the stack pointer register, which must also
  479.      be a fixed register according to `FIXED_REGISTERS'.  On most
  480.      machines, the hardware determines which register this is.
  481. `FRAME_POINTER_REGNUM'
  482.      The register number of the frame pointer register, which is used to
  483.      access automatic variables in the stack frame.  On some machines,
  484.      the hardware determines which register this is.  On other
  485.      machines, you can choose any register you wish for this purpose.
  486. `HARD_FRAME_POINTER_REGNUM'
  487.      On some machines the offset between the frame pointer and starting
  488.      offset of the automatic variables is not known until after register
  489.      allocation has been done (for example, because the saved registers
  490.      are between these two locations).  On those machines, define
  491.      `FRAME_POINTER_REGNUM' the number of a special, fixed register to
  492.      be used internally until the offset is known, and define
  493.      `HARD_FRAME_POINTER_REGNUM' to be actual the hard register number
  494.      used for the frame pointer.
  495.      You should define this macro only in the very rare circumstances
  496.      when it is not possible to calculate the offset between the frame
  497.      pointer and the automatic variables until after register
  498.      allocation has been completed.  When this macro is defined, you
  499.      must also indicate in your definition of `ELIMINABLE_REGS' how to
  500.      eliminate `FRAME_POINTER_REGNUM' into either
  501.      `HARD_FRAME_POINTER_REGNUM' or `STACK_POINTER_REGNUM'.
  502.      Do not define this macro if it would be the same as
  503.      `FRAME_POINTER_REGNUM'.
  504. `ARG_POINTER_REGNUM'
  505.      The register number of the arg pointer register, which is used to
  506.      access the function's argument list.  On some machines, this is
  507.      the same as the frame pointer register.  On some machines, the
  508.      hardware determines which register this is.  On other machines,
  509.      you can choose any register you wish for this purpose.  If this is
  510.      not the same register as the frame pointer register, then you must
  511.      mark it as a fixed register according to `FIXED_REGISTERS', or
  512.      arrange to be able to eliminate it (*note Elimination::.).
  513. `STATIC_CHAIN_REGNUM'
  514. `STATIC_CHAIN_INCOMING_REGNUM'
  515.      Register numbers used for passing a function's static chain
  516.      pointer.  If register windows are used, the register number as
  517.      seen by the called function is `STATIC_CHAIN_INCOMING_REGNUM',
  518.      while the register number as seen by the calling function is
  519.      `STATIC_CHAIN_REGNUM'.  If these registers are the same,
  520.      `STATIC_CHAIN_INCOMING_REGNUM' need not be defined.
  521.      The static chain register need not be a fixed register.
  522.      If the static chain is passed in memory, these macros should not be
  523.      defined; instead, the next two macros should be defined.
  524. `STATIC_CHAIN'
  525. `STATIC_CHAIN_INCOMING'
  526.      If the static chain is passed in memory, these macros provide rtx
  527.      giving `mem' expressions that denote where they are stored.
  528.      `STATIC_CHAIN' and `STATIC_CHAIN_INCOMING' give the locations as
  529.      seen by the calling and called functions, respectively.  Often the
  530.      former will be at an offset from the stack pointer and the latter
  531.      at an offset from the frame pointer.
  532.      The variables `stack_pointer_rtx', `frame_pointer_rtx', and
  533.      `arg_pointer_rtx' will have been initialized prior to the use of
  534.      these macros and should be used to refer to those items.
  535.      If the static chain is passed in a register, the two previous
  536.      macros should be defined instead.
  537. File: gcc.info,  Node: Elimination,  Next: Stack Arguments,  Prev: Frame Registers,  Up: Stack and Calling
  538. Eliminating Frame Pointer and Arg Pointer
  539. -----------------------------------------
  540.    This is about eliminating the frame pointer and arg pointer.
  541. `FRAME_POINTER_REQUIRED'
  542.      A C expression which is nonzero if a function must have and use a
  543.      frame pointer.  This expression is evaluated  in the reload pass.
  544.      If its value is nonzero the function will have a frame pointer.
  545.      The expression can in principle examine the current function and
  546.      decide according to the facts, but on most machines the constant 0
  547.      or the constant 1 suffices.  Use 0 when the machine allows code to
  548.      be generated with no frame pointer, and doing so saves some time
  549.      or space.  Use 1 when there is no possible advantage to avoiding a
  550.      frame pointer.
  551.      In certain cases, the compiler does not know how to produce valid
  552.      code without a frame pointer.  The compiler recognizes those cases
  553.      and automatically gives the function a frame pointer regardless of
  554.      what `FRAME_POINTER_REQUIRED' says.  You don't need to worry about
  555.      them.
  556.      In a function that does not require a frame pointer, the frame
  557.      pointer register can be allocated for ordinary usage, unless you
  558.      mark it as a fixed register.  See `FIXED_REGISTERS' for more
  559.      information.
  560. `INITIAL_FRAME_POINTER_OFFSET (DEPTH-VAR)'
  561.      A C statement to store in the variable DEPTH-VAR the difference
  562.      between the frame pointer and the stack pointer values immediately
  563.      after the function prologue.  The value would be computed from
  564.      information such as the result of `get_frame_size ()' and the
  565.      tables of registers `regs_ever_live' and `call_used_regs'.
  566.      If `ELIMINABLE_REGS' is defined, this macro will be not be used and
  567.      need not be defined.  Otherwise, it must be defined even if
  568.      `FRAME_POINTER_REQUIRED' is defined to always be true; in that
  569.      case, you may set DEPTH-VAR to anything.
  570. `ELIMINABLE_REGS'
  571.      If defined, this macro specifies a table of register pairs used to
  572.      eliminate unneeded registers that point into the stack frame.  If
  573.      it is not defined, the only elimination attempted by the compiler
  574.      is to replace references to the frame pointer with references to
  575.      the stack pointer.
  576.      The definition of this macro is a list of structure
  577.      initializations, each of which specifies an original and
  578.      replacement register.
  579.      On some machines, the position of the argument pointer is not
  580.      known until the compilation is completed.  In such a case, a
  581.      separate hard register must be used for the argument pointer.
  582.      This register can be eliminated by replacing it with either the
  583.      frame pointer or the argument pointer, depending on whether or not
  584.      the frame pointer has been eliminated.
  585.      In this case, you might specify:
  586.           #define ELIMINABLE_REGS  \
  587.           {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
  588.            {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
  589.            {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
  590.      Note that the elimination of the argument pointer with the stack
  591.      pointer is specified first since that is the preferred elimination.
  592. `CAN_ELIMINATE (FROM-REG, TO-REG)'
  593.      A C expression that returns non-zero if the compiler is allowed to
  594.      try to replace register number FROM-REG with register number
  595.      TO-REG.  This macro need only be defined if `ELIMINABLE_REGS' is
  596.      defined, and will usually be the constant 1, since most of the
  597.      cases preventing register elimination are things that the compiler
  598.      already knows about.
  599. `INITIAL_ELIMINATION_OFFSET (FROM-REG, TO-REG, OFFSET-VAR)'
  600.      This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'.  It
  601.      specifies the initial difference between the specified pair of
  602.      registers.  This macro must be defined if `ELIMINABLE_REGS' is
  603.      defined.
  604. `LONGJMP_RESTORE_FROM_STACK'
  605.      Define this macro if the `longjmp' function restores registers from
  606.      the stack frames, rather than from those saved specifically by
  607.      `setjmp'.  Certain quantities must not be kept in registers across
  608.      a call to `setjmp' on such machines.
  609. File: gcc.info,  Node: Stack Arguments,  Next: Register Arguments,  Prev: Elimination,  Up: Stack and Calling
  610. Passing Function Arguments on the Stack
  611. ---------------------------------------
  612.    The macros in this section control how arguments are passed on the
  613. stack.  See the following section for other macros that control passing
  614. certain arguments in registers.
  615. `PROMOTE_PROTOTYPES'
  616.      Define this macro if an argument declared in a prototype as an
  617.      integral type smaller than `int' should actually be passed as an
  618.      `int'.  In addition to avoiding errors in certain cases of
  619.      mismatch, it also makes for better code on certain machines.
  620. `PUSH_ROUNDING (NPUSHED)'
  621.      A C expression that is the number of bytes actually pushed onto the
  622.      stack when an instruction attempts to push NPUSHED bytes.
  623.      If the target machine does not have a push instruction, do not
  624.      define this macro.  That directs GNU CC to use an alternate
  625.      strategy: to allocate the entire argument block and then store the
  626.      arguments into it.
  627.      On some machines, the definition
  628.           #define PUSH_ROUNDING(BYTES) (BYTES)
  629.      will suffice.  But on other machines, instructions that appear to
  630.      push one byte actually push two bytes in an attempt to maintain
  631.      alignment.  Then the definition should be
  632.           #define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
  633. `ACCUMULATE_OUTGOING_ARGS'
  634.      If defined, the maximum amount of space required for outgoing
  635.      arguments will be computed and placed into the variable
  636.      `current_function_outgoing_args_size'.  No space will be pushed
  637.      onto the stack for each call; instead, the function prologue should
  638.      increase the stack frame size by this amount.
  639.      Defining both `PUSH_ROUNDING' and `ACCUMULATE_OUTGOING_ARGS' is
  640.      not proper.
  641. `REG_PARM_STACK_SPACE (FNDECL)'
  642.      Define this macro if functions should assume that stack space has
  643.      been allocated for arguments even when their values are passed in
  644.      registers.
  645.      The value of this macro is the size, in bytes, of the area
  646.      reserved for arguments passed in registers for the function
  647.      represented by FNDECL.
  648.      This space can be allocated by the caller, or be a part of the
  649.      machine-dependent stack frame: `OUTGOING_REG_PARM_STACK_SPACE' says
  650.      which.
  651. `MAYBE_REG_PARM_STACK_SPACE'
  652. `FINAL_REG_PARM_STACK_SPACE (CONST_SIZE, VAR_SIZE)'
  653.      Define these macros in addition to the one above if functions might
  654.      allocate stack space for arguments even when their values are
  655.      passed in registers.  These should be used when the stack space
  656.      allocated for arguments in registers is not a simple constant
  657.      independent of the function declaration.
  658.      The value of the first macro is the size, in bytes, of the area
  659.      that we should initially assume would be reserved for arguments
  660.      passed in registers.
  661.      The value of the second macro is the actual size, in bytes, of the
  662.      area that will be reserved for arguments passed in registers.
  663.      This takes two arguments: an integer representing the number of
  664.      bytes of fixed sized arguments on the stack, and a tree
  665.      representing the number of bytes of variable sized arguments on
  666.      the stack.
  667.      When these macros are defined, `REG_PARM_STACK_SPACE' will only be
  668.      called for libcall functions, the current function, or for a
  669.      function being called when it is known that such stack space must
  670.      be allocated.  In each case this value can be easily computed.
  671.      When deciding whether a called function needs such stack space,
  672.      and how much space to reserve, GNU CC uses these two macros
  673.      instead of `REG_PARM_STACK_SPACE'.
  674. `OUTGOING_REG_PARM_STACK_SPACE'
  675.      Define this if it is the responsibility of the caller to allocate
  676.      the area reserved for arguments passed in registers.
  677.      If `ACCUMULATE_OUTGOING_ARGS' is defined, this macro controls
  678.      whether the space for these arguments counts in the value of
  679.      `current_function_outgoing_args_size'.
  680. `STACK_PARMS_IN_REG_PARM_AREA'
  681.      Define this macro if `REG_PARM_STACK_SPACE' is defined, but the
  682.      stack parameters don't skip the area specified by it.
  683.      Normally, when a parameter is not passed in registers, it is
  684.      placed on the stack beyond the `REG_PARM_STACK_SPACE' area.
  685.      Defining this macro suppresses this behavior and causes the
  686.      parameter to be passed on the stack in its natural location.
  687. `RETURN_POPS_ARGS (FUNTYPE, STACK-SIZE)'
  688.      A C expression that should indicate the number of bytes of its own
  689.      arguments that a function pops on returning, or 0 if the function
  690.      pops no arguments and the caller must therefore pop them all after
  691.      the function returns.
  692.      FUNTYPE is a C variable whose value is a tree node that describes
  693.      the function in question.  Normally it is a node of type
  694.      `FUNCTION_TYPE' that describes the data type of the function.
  695.      From this it is possible to obtain the data types of the value and
  696.      arguments (if known).
  697.      When a call to a library function is being considered, FUNTYPE
  698.      will contain an identifier node for the library function.  Thus, if
  699.      you need to distinguish among various library functions, you can
  700.      do so by their names.  Note that "library function" in this
  701.      context means a function used to perform arithmetic, whose name is
  702.      known specially in the compiler and was not mentioned in the C
  703.      code being compiled.
  704.      STACK-SIZE is the number of bytes of arguments passed on the
  705.      stack.  If a variable number of bytes is passed, it is zero, and
  706.      argument popping will always be the responsibility of the calling
  707.      function.
  708.      On the Vax, all functions always pop their arguments, so the
  709.      definition of this macro is STACK-SIZE.  On the 68000, using the
  710.      standard calling convention, no functions pop their arguments, so
  711.      the value of the macro is always 0 in this case.  But an
  712.      alternative calling convention is available in which functions
  713.      that take a fixed number of arguments pop them but other functions
  714.      (such as `printf') pop nothing (the caller pops all).  When this
  715.      convention is in use, FUNTYPE is examined to determine whether a
  716.      function takes a fixed number of arguments.
  717. File: gcc.info,  Node: Register Arguments,  Next: Scalar Return,  Prev: Stack Arguments,  Up: Stack and Calling
  718. Passing Arguments in Registers
  719. ------------------------------
  720.    This section describes the macros which let you control how various
  721. types of arguments are passed in registers or how they are arranged in
  722. the stack.
  723. `FUNCTION_ARG (CUM, MODE, TYPE, NAMED)'
  724.      A C expression that controls whether a function argument is passed
  725.      in a register, and which register.
  726.      The arguments are CUM, which summarizes all the previous
  727.      arguments; MODE, the machine mode of the argument; TYPE, the data
  728.      type of the argument as a tree node or 0 if that is not known
  729.      (which happens for C support library functions); and NAMED, which
  730.      is 1 for an ordinary argument and 0 for nameless arguments that
  731.      correspond to `...' in the called function's prototype.
  732.      The value of the expression should either be a `reg' RTX for the
  733.      hard register in which to pass the argument, or zero to pass the
  734.      argument on the stack.
  735.      For machines like the Vax and 68000, where normally all arguments
  736.      are pushed, zero suffices as a definition.
  737.      The usual way to make the ANSI library `stdarg.h' work on a machine
  738.      where some arguments are usually passed in registers, is to cause
  739.      nameless arguments to be passed on the stack instead.  This is done
  740.      by making `FUNCTION_ARG' return 0 whenever NAMED is 0.
  741.      You may use the macro `MUST_PASS_IN_STACK (MODE, TYPE)' in the
  742.      definition of this macro to determine if this argument is of a
  743.      type that must be passed in the stack.  If `REG_PARM_STACK_SPACE'
  744.      is not defined and `FUNCTION_ARG' returns non-zero for such an
  745.      argument, the compiler will abort.  If `REG_PARM_STACK_SPACE' is
  746.      defined, the argument will be computed in the stack and then
  747.      loaded into a register.
  748. `FUNCTION_INCOMING_ARG (CUM, MODE, TYPE, NAMED)'
  749.      Define this macro if the target machine has "register windows", so
  750.      that the register in which a function sees an arguments is not
  751.      necessarily the same as the one in which the caller passed the
  752.      argument.
  753.      For such machines, `FUNCTION_ARG' computes the register in which
  754.      the caller passes the value, and `FUNCTION_INCOMING_ARG' should be
  755.      defined in a similar fashion to tell the function being called
  756.      where the arguments will arrive.
  757.      If `FUNCTION_INCOMING_ARG' is not defined, `FUNCTION_ARG' serves
  758.      both purposes.
  759. `FUNCTION_ARG_PARTIAL_NREGS (CUM, MODE, TYPE, NAMED)'
  760.      A C expression for the number of words, at the beginning of an
  761.      argument, must be put in registers.  The value must be zero for
  762.      arguments that are passed entirely in registers or that are
  763.      entirely pushed on the stack.
  764.      On some machines, certain arguments must be passed partially in
  765.      registers and partially in memory.  On these machines, typically
  766.      the first N words of arguments are passed in registers, and the
  767.      rest on the stack.  If a multi-word argument (a `double' or a
  768.      structure) crosses that boundary, its first few words must be
  769.      passed in registers and the rest must be pushed.  This macro tells
  770.      the compiler when this occurs, and how many of the words should go
  771.      in registers.
  772.      `FUNCTION_ARG' for these arguments should return the first
  773.      register to be used by the caller for this argument; likewise
  774.      `FUNCTION_INCOMING_ARG', for the called function.
  775. `FUNCTION_ARG_PASS_BY_REFERENCE (CUM, MODE, TYPE, NAMED)'
  776.      A C expression that indicates when an argument must be passed by
  777.      reference.  If nonzero for an argument, a copy of that argument is
  778.      made in memory and a pointer to the argument is passed instead of
  779.      the argument itself.  The pointer is passed in whatever way is
  780.      appropriate for passing a pointer to that type.
  781.      On machines where `REG_PARM_STACK_SPACE' is not defined, a suitable
  782.      definition of this macro might be
  783.           #define FUNCTION_ARG_PASS_BY_REFERENCE\
  784.           (CUM, MODE, TYPE, NAMED)  \
  785.             MUST_PASS_IN_STACK (MODE, TYPE)
  786. `FUNCTION_ARG_CALLEE_COPIES (CUM, MODE, TYPE, NAMED)'
  787.      If defined, a C expression that indicates when it is the called
  788.      function's responsibility to make a copy of arguments passed by
  789.      invisible reference.  Normally, the caller makes a copy and passes
  790.      the address of the copy to the routine being called.  When
  791.      FUNCTION_ARG_CALLEE_COPIES is defined and is nonzero, the caller
  792.      does not make a copy.  Instead, it passes a pointer to the "live"
  793.      value.  The called function must not modify this value.  If it can
  794.      be determined that the value won't be modified, it need not make a
  795.      copy; otherwise a copy must be made.
  796. `CUMULATIVE_ARGS'
  797.      A C type for declaring a variable that is used as the first
  798.      argument of `FUNCTION_ARG' and other related values.  For some
  799.      target machines, the type `int' suffices and can hold the number
  800.      of bytes of argument so far.
  801.      There is no need to record in `CUMULATIVE_ARGS' anything about the
  802.      arguments that have been passed on the stack.  The compiler has
  803.      other variables to keep track of that.  For target machines on
  804.      which all arguments are passed on the stack, there is no need to
  805.      store anything in `CUMULATIVE_ARGS'; however, the data structure
  806.      must exist and should not be empty, so use `int'.
  807. `INIT_CUMULATIVE_ARGS (CUM, FNTYPE, LIBNAME)'
  808.      A C statement (sans semicolon) for initializing the variable CUM
  809.      for the state at the beginning of the argument list.  The variable
  810.      has type `CUMULATIVE_ARGS'.  The value of FNTYPE is the tree node
  811.      for the data type of the function which will receive the args, or 0
  812.      if the args are to a compiler support library function.
  813.      When processing a call to a compiler support library function,
  814.      LIBNAME identifies which one.  It is a `symbol_ref' rtx which
  815.      contains the name of the function, as a string.  LIBNAME is 0 when
  816.      an ordinary C function call is being processed.  Thus, each time
  817.      this macro is called, either LIBNAME or FNTYPE is nonzero, but
  818.      never both of them at once.
  819. `INIT_CUMULATIVE_INCOMING_ARGS (CUM, FNTYPE, LIBNAME)'
  820.      Like `INIT_CUMULATIVE_ARGS' but overrides it for the purposes of
  821.      finding the arguments for the function being compiled.  If this
  822.      macro is undefined, `INIT_CUMULATIVE_ARGS' is used instead.
  823.      The value passed for LIBNAME is always 0, since library routines
  824.      with special calling conventions are never compiled with GNU CC.
  825.      The argument LIBNAME exists for symmetry with
  826.      `INIT_CUMULATIVE_ARGS'.
  827. `FUNCTION_ARG_ADVANCE (CUM, MODE, TYPE, NAMED)'
  828.      A C statement (sans semicolon) to update the summarizer variable
  829.      CUM to advance past an argument in the argument list.  The values
  830.      MODE, TYPE and NAMED describe that argument.  Once this is done,
  831.      the variable CUM is suitable for analyzing the *following*
  832.      argument with `FUNCTION_ARG', etc.
  833.      This macro need not do anything if the argument in question was
  834.      passed on the stack.  The compiler knows how to track the amount
  835.      of stack space used for arguments without any special help.
  836. `FUNCTION_ARG_PADDING (MODE, TYPE)'
  837.      If defined, a C expression which determines whether, and in which
  838.      direction, to pad out an argument with extra space.  The value
  839.      should be of type `enum direction': either `upward' to pad above
  840.      the argument, `downward' to pad below, or `none' to inhibit
  841.      padding.
  842.      The *amount* of padding is always just enough to reach the next
  843.      multiple of `FUNCTION_ARG_BOUNDARY'; this macro does not control
  844.      it.
  845.      This macro has a default definition which is right for most
  846.      systems.  For little-endian machines, the default is to pad
  847.      upward.  For big-endian machines, the default is to pad downward
  848.      for an argument of constant size shorter than an `int', and upward
  849.      otherwise.
  850. `FUNCTION_ARG_BOUNDARY (MODE, TYPE)'
  851.      If defined, a C expression that gives the alignment boundary, in
  852.      bits, of an argument with the specified mode and type.  If it is
  853.      not defined, `PARM_BOUNDARY' is used for all arguments.
  854. `FUNCTION_ARG_REGNO_P (REGNO)'
  855.      A C expression that is nonzero if REGNO is the number of a hard
  856.      register in which function arguments are sometimes passed.  This
  857.      does *not* include implicit arguments such as the static chain and
  858.      the structure-value address.  On many machines, no registers can be
  859.      used for this purpose since all function arguments are pushed on
  860.      the stack.
  861.